Using ROS Service API


In [1]:
%pylab inline
import rospy, tf
import vrep_common.srv
import geometry_msgs.msg, std_msgs.msg
import time
import matplotlib.pyplot as plt
import pylab
import numpy as np


Populating the interactive namespace from numpy and matplotlib

In [4]:
getHandle = rospy.ServiceProxy('/vrep/simRosGetObjectHandle',
                         vrep_common.srv.simRosGetObjectHandle)

In [5]:
getHandle('Cuboid')


Out[5]:
handle: 26

In [7]:
getHandle('Revolute_joint')


Out[7]:
handle: 27

In [8]:
set_joint_position = rospy.ServiceProxy('/vrep/simRosSetJointTargetPosition',
                         vrep_common.srv.simRosSetJointTargetPosition)

In [16]:
set_joint_position(27, 0)


Out[16]:
result: 1

In [35]:
set_joint_position(27, 0)


Out[35]:
result: 1

In [22]:
import IPython.html.widgets as ipywidgets

In [20]:
def setpoint(x):
    set_joint_position(27, x)

In [34]:
ipywidgets.interact(setpoint, x=ipywidgets.FloatSliderWidget())